/**
	// 弹出聊天界面
  */
export default taskPost

function taskPost(avatar, userName, qrcode, taskName, reward, unit) {
	// 创建画布
	console.log('画画')
	const ctx = uni.createCanvasContext('invitation-post')
	//背景图片
	ctx.drawImage('https://images.linglinggong.net/static/icon1/08.png', 0, 0, 305, 403)
	//找零工logo
	ctx.setFillStyle('#402110')
	ctx.font = "bold 20px PingFangSC-Medium";
	ctx.fillText('找零工', 135, 40)
	//说明
	ctx.setFillStyle('rgba(64,33,16,0.50)')
	ctx.font = "14px PingFangSC-Regular";
	ctx.fillText('来自' + userName + '的分享', 163 / 2, 90 / 2 + 25)
	// 工作名称
	ctx.setFillStyle('#402110')
	ctx.font = "18px PingFangSC-Regular";
	ctx.fillText(taskName, 105 / 2, 115)
	// 工作报酬F39B19
	ctx.setFillStyle('#FF650C')
	// normal bold 18px arial,sans-serif
	ctx.font = "normal bold 18px PingFangSC-Regular"
	ctx.fillText(reward + unit, 105 / 2, 145)
	//二维码
	ctx.drawImage(qrcode, 105 / 2, 310 / 2, 200, 200)
	//提示
	ctx.setFillStyle('#402110')
	ctx.font = "14px PingFangSC-Regular";
	ctx.fillText('长按二维码保存至相册', 166 / 2, 726 / 2 + 20)
	//任务头像
	ctx.arc(55, 60, 15, 0, 2 * Math.PI) // 画圆
	ctx.clip()
	ctx.drawImage(avatar, 40, 45, 30, 30)
	setTimeout(() => {
		ctx.draw(false, () => {
			uni.canvasToTempFilePath({
				canvasId: 'invitation-post',
				success: (res) => {
					uni.hideLoading()
					this.postUrlTask = res.tempFilePath
					uni.setStorageSync('postUrlTask', res.tempFilePath)
					console.log('保存了海报postUrlTask', uni.getStorageSync('postUrlTask'))
				},
				fail: (err) => {
					console.log('画图失败', err)
				}
			})
		})
	}, 800)
}
